package com.wy.poties.constant

/**
 * API 统一返回状态码
 */
enum class ResultCode {
    /* 成功状态码 */
    SUCCESS(200, "成功"),  /* 参数错误：10001-19999 */
    PARAM_IS_INVALID(10001, "参数无效"),
    PARAM_IS_BLANK(10002, "参数为空"),
    PARAM_TYPE_BIND_ERROR(10003, "参数类型错误"),
    PARAM_NOT_COMPLETE(10004, "参数缺失"),
    PARAM_SMS_CODE_DO_NOT_EXIST(10005, "请先获取短信验证码或验证码已失效"),
    PARAM_SMS_CODE_ERROR(10006, "短信验证码错误"),
    PARAM_VERIFY_CODE_ERROR(10007, "图形验证码错误"),  /* 用户错误：20001-29999*/
    USER_NOT_LOGGED_IN(20001, "用户未登录"), USER_LOGIN_ERROR(20002, "账号不存在或密码错误"),
    USER_ACCOUNT_FORBIDDEN(20003, "账号已被禁用"), USER_NOT_EXIST(20004, "用户不存在"),
    USER_HAS_EXISTED(20005, "用户已存在"), USER_PHONE_EXISTED(20006, "手机号已注册"),
    USER_NAME_CARD_NOT_MATCH(20007, "身份证号和姓名不匹配"), USER_ID_CARD_EXISTED(20008, "身份证号已存在"),

    USER_LOGIN_TIMEOUT(20009, "登录状态失效，未获取到登录状态"), USER_NOT_REAL(20010, "用户未实名"),
    USER_PHONE_HAS_BE_BIND(20011, "手机号已绑定其他微信"), USER_PWD_HAS_NOT_EQ(20012, "请输入正确的旧密码"),  /* 业务错误：30001-39999 */
    SPECIFIED_QUESTIONED_USER_NOT_EXIST(30001, "某业务出现问题"),  /* 系统错误：40001-49999 */
    SYSTEM_INNER_ERROR(40001, "系统繁忙，请稍后重试"),
    SYSTEM_IN_MAINTENANCE(40002, "系统维护中"),

    SYSTEM_IS_TOO_BUSY(40003, "操作频繁，请稍候再试"),  /* 数据错误：50001-599999 */
    RESULT_DATA_NONE(50001, "未查询到相关信息"),
    DATA_IS_WRONG(50002, "数据有误"),
    DATA_ALREADY_EXISTED(50003, "数据已存在"),
    DATA_SECURITY_CHECK_FAIL(50004, "检测到敏感词汇，请修改后重试"),
    DATA_EXIST_PRODUCT(50005, "存在已关联产品，不能删除"),
    DATA_EXIST_SON_SERVICE(50006, "存在子分类，不能删除"), /* 接口错误：60001-69999 */
    INTERFACE_INNER_INVOKE_ERROR(60001, "内部系统接口调用异常"),
    INTERFACE_OUTER_INVOKE_ERROR(60002, "外部系统接口调用异常"),
    INTERFACE_FORBID_VISIT(60003, "该接口禁止访问"),
    INTERFACE_ADDRESS_INVALID(60004, "接口地址无效"),
    INTERFACE_REQUEST_TIMEOUT(60005, "接口请求超时"),
    INTERFACE_EXCEED_LOAD(60006, "接口负载过高"),
    INTERFACE_GET_SMS_CODE_ERROR(60007, "获取短信验证码失败，请稍后再试"),  /* 权限错误：70001-79999 */
    PERMISSION_NO_ACCESS(70001, "无访问权限"),  /* 操作错误：80001-89999 */
    OPERATE_ONE_MINUTE_ONE_SMS(80001, "一分钟内只能获取一次短信验证码"),
    OPERATE_CODE_BEEN_USED(80002, "当前code已被使用过"),
    OPERATE_CODE_REPORT_FAIL(80003, "报表插入失败"),
    OPERATE_CODE_EXPORT_FAIL(80004, "导出数据失败");

    private var code: Int? = null

    private var message: String? = null

    constructor(code: Int, message: String) {
        this.code = code
        this.message = message
    }

    fun code(): Int? {
        return code
    }

    fun message(): String? {
        return message
    }

    override fun toString(): String {
        return name
    }


}